home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-04-20 | 2.4 KB | 102 lines | [TEXT/PJMM] |
- unit StatusLDEF;
-
- { This program was written by Peter N Lewis, Mar 1992 in THINK Pascal 4.0.1 }
-
- interface
-
- procedure Main (message: integer; select: boolean; var r: Rect; c: Cell; dataOffset, dataLen: integer; lh: ListHandle);
-
- implementation
-
- uses
- LDEFTypes;
-
- const
- sicn1_offset = 2;
- sicn2_offset = 20;
- str_offset = 38;
-
- procedure Main (message: integer; select: boolean; var r: Rect; c: Cell; dataOffset, dataLen: integer; lh: ListHandle);
- procedure DoInit;
- var
- fi: FontInfo;
- begin
- GetFontInfo(fi);
- lh^^.cellsize.v := 18;
- lh^^.indent.v := fi.ascent + 1;
- lh^^.indent.h := 4;
- end;
-
- procedure DoClose;
- begin
- end;
-
- procedure DoDraw;
- var
- where: point;
- procedure PlotSICN (id, index: integer; offset: integer);
- var
- iconH: handle;
- iconMap: bitmap;
- iconRect: rect;
- begin
- iconH := GetResource('SICN', id);
- if iconH <> nil then begin
- HLock(iconH);
- iconMap.baseAddr := ptr(ord(iconH^) + (index - 1) * 32);
- iconMap.rowBytes := 2;
- SetRect(iconmap.bounds, 0, 0, 16, 16);
- iconRect.left := r.left + offset;
- iconRect.top := r.top + 1;
- iconRect.right := iconRect.left + 16;
- iconRect.bottom := iconRect.top + 16;
- CopyBits(iconmap, lh^^.port^.portbits, iconmap.bounds, iconRect, srcCopy, nil);
- HUnlock(iconH);
- HPurge(iconH);
- end
- end;
- var
- celldata: cellRecord;
- s: str255;
- sw: integer;
- begin
- if datalen > SizeOf(celldata) - SizeOf(celldata.str2) then begin
- where.h := r.left + lh^^.indent.h;
- where.v := r.top + lh^^.indent.v;
- PenNormal;
- if datalen > SizeOf(celldata) then
- datalen := SizeOf(celldata);
- BlockMove(ptr(longInt(lh^^.cells^) + dataoffset), @celldata, datalen);
- EraseRect(r);
- PlotSICN(celldata.sicn1id, celldata.sicn1index, sicn1_offset);
- PlotSICN(celldata.sicn2id, celldata.sicn2index, sicn2_offset);
- IUTimeString(longInt(60) * 60 * 24 - 60, false, s);
- sw := StringWidth(s);
- MoveTo(where.h + str_offset + sw - StringWidth(celldata.str1), where.v);
- DrawString(celldata.str1);
- MoveTo(where.h + str_offset + sw + 2, where.v);
- DrawString(celldata.str2);
- end;
- if select then
- InvertRect(r);
- end;
-
- procedure DoHilite;
- begin
- InvertRect(r);
- end;
-
- begin
- case message of
- lInitMsg:
- DoInit;
- lDrawMsg:
- DoDraw;
- lHiliteMsg:
- DoHilite;
- lCloseMsg:
- DoClose;
- end;
- end;
-
- end.